package com.norns.torque.entrty;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Entity(tableName = "Scale")
public class ScaleBean {
    @PrimaryKey(autoGenerate = true)
    private Long uid;

    @ColumnInfo(name = "DeviceName")
    private String deviceName;

    @ColumnInfo(name = "TargetValue")
    private int targetValue;

    @ColumnInfo(name = "Unit")
    private String unit;

    @ColumnInfo(name = "PrecisionDegree")
    private int precisionDegree;

    @Ignore
    private String count;

    @ColumnInfo(name = "Value")
    private Float value;

    @ColumnInfo(name = "Data")
    private LocalDateTime date;

    public ScaleBean(){}

    @Ignore
    public ScaleBean(String deviceName,int targetValue, String unit, int precisionDegree, String count, Float value, LocalDateTime date) {
        this.targetValue = targetValue;
        this.deviceName = deviceName;
        this.unit = unit;
        this.precisionDegree = precisionDegree;
        this.count = count;
        this.value = value;
        this.date = date;
    }

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public int getTargetValue() {
        return targetValue;
    }

    public void setTargetValue(int targetValue) {
        this.targetValue = targetValue;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public int getPrecisionDegree() {
        return precisionDegree;
    }

    public void setPrecisionDegree(int precisionDegree) {
        this.precisionDegree = precisionDegree;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }

    public Float getValue() {
        return value;
    }

    public void setValue(Float value) {
        this.value = value;
    }

    public LocalDateTime getDate() {
        return date;
    }
    public String getDateStr() {
        DateTimeFormatter f2= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return date.format(f2);
    }
    public void setDate(LocalDateTime date) {
        this.date = date;
    }


    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

}
